import Vue from 'vue'
window._xvueEvtBus = new Vue()

window._xvueEvtBus.clear = function (evtId) {
  if (window._xvueEvtBus._events[evtId] && window._xvueEvtBus._events[evtId].length > 1) {
    window._xvueEvtBus._events[evtId].length = 1
  }
}

window._xvueEvtBus.clear = function (evtId, maxNum) {
  if (window._xvueEvtBus._events[evtId] && maxNum && window._xvueEvtBus._events[evtId].length > maxNum) {
    window._xvueEvtBus._events[evtId].length = maxNum
  } else if (window._xvueEvtBus._events[evtId] && window._xvueEvtBus._events[evtId].length > 1) {
    window._xvueEvtBus._events[evtId].length = 1
  }
}
